package com.fdd.spring.aop.xml;


import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.*;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

import java.util.Arrays;


//这是一个切面类，但是不使用注解方式，而是使用xml配置
public class SmartAnimalAspect {


    public static void f1(JoinPoint joinPoint){
        joinPoint.getSignature();//获取方法签名
        System.out.println("FddAop-方法执行前-日志-方法名-" + joinPoint.getSignature() + "-参数：" + Arrays.toString(joinPoint.getArgs()));
    }

    public void f2(JoinPoint joinPoint,Object result){
        System.out.println("SmartAnimalable-FddAop-方法执行后-日志-方法名-" + joinPoint.getSignature() + "-参数：" + Arrays.toString(joinPoint.getArgs()) + "-结果：" + result);
    }

    public void f3(JoinPoint joinPoint, Exception ex){
        System.out.println("SmartAnimalable-FddAop-方法执行异常-日志-方法名-" + joinPoint.getSignature() + "-参数：" + Arrays.toString(joinPoint.getArgs()) + "-异常：" + ex);
    }

    public void f4(JoinPoint joinPoint){
        System.out.println("SmartAnimalable-FddAop-方法执行后最终通知-日志-方法名-" + joinPoint.getSignature() + "-参数：" + Arrays.toString(joinPoint.getArgs()));
    }


}
